package com.hflyeer.util;

import com.hflyeer.pojo.ResponseBean;

/**
 * ResponseUtil
 *
 * @author hflyeer
 * @date 2021-06-01
 * @describe 相应工具类
 */
public class ResponseUtil {

    /**
     * 操作成功
     * @return
     */
    public static ResponseBean success(){
        return new ResponseBean(200,true,null);
    }

    /**
     * 操作成功
     * @param data 响应数据
     * @return
     */
    public static ResponseBean success(Object data){
        return new ResponseBean(200,true,data);
    }

    /**
     * 操作成功
     * @param bean 响应数据
     * @return
     */
    public static ResponseBean success(ResponseBean bean){
        return bean;
    }

    /**
     * 操作失败
     * @param code
     * @param success
     * @return
     */
    public static ResponseBean fail(Integer code,boolean success){
        return new ResponseBean(code,success,null);
    }

    /**
     * 操作失败
     * @param code
     * @param success
     * @param data
     * @return
     */
    public static ResponseBean fail(Integer code,boolean success,Object data){
        return new ResponseBean(code,success,data);
    }

}
